<?php

namespace KGK\UserBundle\Form\Type;

use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\AbstractType;

class RegistrationFormType extends AbstractType
{
    private $class;

    /**
     * @param string $class The User class name
     */
    public function __construct($class)
    {
        $this->class = $class;
    }

    public function buildForm(FormBuilder $builder, array $options)
    {
        $builder
            ->add('username')
            ->add('email', 'email')
            ->add('nom', 'text')
            ->add('prenom', 'text')
            ->add('adresse', 'text')
            ->add('code_postal', 'number')
            ->add('ville', 'text')
            ->add('telephone', 'number');
    }

    public function getDefaultOptions(array $options)
    {
        return array(
            'data_class' => $this->class,
            'intention'  => 'registration',
        );
    }

    public function getName()
    {
        return 'kgk_user_registration';
    }
}